package com.smartcruise.data;

import com.smartcruise.util.TimeUtils;

import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;

/**
 * Created by FengChaoQun
 * on 2018/3/10 0010
 * 保存分页记录
 */

public class PageHistory extends RealmObject {

    public static final int pageSize = 20;

    public static final int TYPE_COMPLETED_TASK = 1;
    public static final int TYPE_NOTICE = 2;
    public static final int TYPE_REPORT = 3;

    @PrimaryKey
    private int type;
    private String userId;
    private long totalNumber;
    private int currentPage;
    private long lastRefreshTime;

    public boolean hasNextData() {
        return currentPage * pageSize < totalNumber;
    }

    public boolean needRefresh() {
        return TimeUtils.currentTime() - lastRefreshTime > 60 * 60 * 1000;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public long getTotalNumber() {
        return totalNumber;
    }

    public void setTotalNumber(long totalNumber) {
        this.totalNumber = totalNumber;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public long getLastRefreshTime() {
        return lastRefreshTime;
    }

    public void setLastRefreshTime(long lastRefreshTime) {
        this.lastRefreshTime = lastRefreshTime;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }
}
